import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CommentFishSiteVo } from "@/api/front/comment/types";
/**
 * @description 帖子评论
 * @param query {
    "targetId": "文章id",
    "parentId": "父级id",
    "replyUserId": "被回复用户的id",
    "content": "测试评论-回复二级评论"
    "replyContent": "被回复评论的内容 回复一级评论和二级评论的时候使用"
}
 * @returns
 */
export const commentPush = (query?: any): AxiosPromise<any> => {
    return request({
      url: '/api/comment/posts',
      method: 'post',
      data: query
    });
};

/**
 * @description 分页获取评论列表
 * @param query {
  "pageQuery": {
    "pageSize": 10,
    "pageNum": 1,
    "orderByColumn": "排序 最热的时候 使用like_count;  最新使用 create_time",
    "isAsc": "最热时 传递 desc   最新时 传递  asc"
  },
  "targetId" : "文章id",
  "parentId": "父级id "
}
 * @returns
 */
export const commentList = (query?: any): AxiosPromise<any> => {
    return request({
      url: '/api/comment/posts/page/list',
      method: 'post',
      data: query
    });
};

/**
 * @deprecated 置顶评论
 * @param query {
    "type": "top",置顶   untop取消置顶
    "postsId": "1863608016219246594"
}
 * @returns
 */
export const commentSetTop = (query?: any): AxiosPromise<any> => {
    return request({
      url: '/api/comment/posts/top',
      method: 'post',
      data: query
    });
};

/**
 * @deprecated 删除评论
 * @param query {
    "commentId": "文章id"
}
 * @returns
 */
export const commentDelete = (query?: any): AxiosPromise<any> => {
    return request({
      url: '/api/comment/posts/delete',
      method: 'post',
      data: query
    });
  }

